package com.fuyd.pms.entity.account;

import com.fuyd.pms.entity.base.BaseEntityGen;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 商家登陆密码凭据
 * Created by fuyongde on 2015/12/23.
 */
@Entity
@Table(name = "pms_local_auth")
public class LocalAuth extends BaseEntityGen {
    /**所属的用户**/
    private MerchantUser merchantUser;
    /**用户名**/
    private String username;
    /**密码**/
    private String password;
    /**随机盐**/
    private String salt;

    @OneToOne
    public MerchantUser getMerchantUser() {
        return merchantUser;
    }

    public void setMerchantUser(MerchantUser merchantUser) {
        this.merchantUser = merchantUser;
    }

    @Type(type = "string")
    @Length(min = 6, max = 16)
    @Column(nullable = false)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Type(type = "string")
    @Length(max = 128)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Type(type = "string")
    @Length(max = 16)
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

}
